package com.loriot.common.zero_array_transformation_i_3355;

/**
 * @Title: pointsThatIntersectWithCars_2848
 * @Package: com.loriot.common
 * @Description:
 * @Author: zzy boy
 * @Date: 2025/10/21 10:36
 * @Version: 0.0.1-alpha
 */

public class Main {
    class Solution {
        public boolean isZeroArray(int[] nums, int[][] queries) {
            int[] differ= new int[nums.length];
            for(int[] item:queries){
                differ[item[0]]+=1;
                if(item[1]+1==nums.length)continue;
                differ[item[1]+1]-=1;
            }
            int count = 0;
            for(int i=0;i<nums.length;i++){
                count += differ[i];
                nums[i] -= count;
                if(nums[i]>0)return false;
            }

            return true;
        }
    }
}
